# -*- coding: UTF-8 -*-
# import numpy as np
from scipy import stats

data = {
	'年龄': [
		[74,51,71,65,69,67,57,32,66,62,57,55,35,50,34,26,53,61,59,64,62,41,76,60,51,61,31,24,48,71,24,73,52,58,67,42,50,33,26,38,33,47,64],
		[41,49,61,36,45,62,81,59,72,73,81,39,60,42,67,47,45,65,36,61,53,62,63,48,45,59,70,53,62,71,60,37,52,53,43,68,36,46,73,53,54,36,67,51,61,42,43,52,71,66,72,65],
	],
	'身高': [
		[1.65,1.75,1.58,1.62,1.6,1.57,1.52,1.67,1.65,1.5,1.65,1.68,1.65,1.81,1.68,1.71,1.8,1.72,1.55,1.7,1.63,1.63,1.55,1.58,1.58,1.6,1.66,1.53,1.6,1.62,1.59,1.62,1.69,1.7,1.68,1.7,1.6,1.57,1.55,1.55,1.65,1.72,1.72],
		[1.76,1.55,1.65,1.55,1.63,1.54,1.63,1.62,1.5,1.55,1.6,1.57,1.6,1.65,1.5,1.55,1.78,1.67,1.75,1.69,1.65,1.57,1.55,1.64,1.72,1.45,1.53,1.55,1.6,1.6,1.66,1.77,1.69,1.65,1.75,1.6,1.7,1.76,1.48,1.7,1.6,1.7,1.7,1.66,1.68,1.75,1.64,1.76,1.5,1.52,1.68,1.7],
	],
	'体重': [
		[67,70,51.9,50,70.5,60,67,52,75,55,65,68,64.6,90,63,105,85,80,46.8,69.9,61.6,56,63.9,60,60,56.3,84,55,44,59,59.6,74.1,70.2,67.2,65,44,48.1,53,64,82.3,69],
		[65,75,59,59,57,62,60,50,44,57,61,63,58,45,64,60,83,70,65,71,94,62,68,73,98,50,59,59,63,75,55,83,72,64,76,69,75,68,45,67,64,67,50,81,61,80,62,55,41,50,64,68],
	],
	'BMI': [
		[24.61,22.86,20.79,19.05,27.54,24.34,29.00,18.65,27.55,24.44,23.88,24.09,23.73,27.47,22.32,35.91,26.23,27.04,19.48,24.19,23.18,21.08,25.60,24.03,23.44,20.43,32.81,20.96,17.40,22.48,20.87,25.64,24.87,23.25,25.39,17.85,20.02,22.06,23.51,27.82,23.32],
		[20.98,31.22,21.67,24.56,21.45,26.14,22.58,19.05,19.56,23.73,23.83,25.56,22.66,16.53,28.44,24.97,26.20,25.10,21.22,24.86,34.53,25.15,28.30,27.14,33.13,23.78,25.20,24.56,24.61,29.30,19.96,26.49,25.21,23.51,24.82,26.95,25.95,21.95,20.54,23.18,25.00,23.18,17.30,29.39,21.61,26.12,23.05,17.76,18.22,21.64,22.68,23.53],
	],
	'肌酐': [
		[331.7,102.4,248,321.3,94.7,115.2,105.8,207.4,175,153.2,128.4,86.8,123,280.2,273.3,183,165,224.6,134.3,149.8,229.5,354,109.9,157.2,88,106.1,170.5,288.2,302.5,199.5,205.5,161.1,160.1,166.6,257.6,96.9,245.8,129.1,375,173.5,225.7,176.2,181.5],
		[265,352,538,119.7,163.8,239,113,119.1,217,98,146,120.2,99,556,118,202,200,141,205,275,160,145,248.8,226,217,120,246,285,194.3,364.3,207.9,375,166,268,124.8,272,157.5,458,477.8,165,449.2,160,344,129,231,203,197,147,124,392,184,325],
	],
	'尿酸': [
		[442.1,298.2,473.5,402.4,362.6,431.2,446.9,290.6,491.1,260.5,276.1,359.5,360,410.4,279.3,501.7,399.2,592.3,325.7,421.3,449.5,703.1,337,354.1,463.8,518.6,437.6,693.6,491.5,432.7,715.6,440.6,483.8,517.3,367.2,419.7,837.6,536.4,415,357.1,699.6,512.3,452.9],
		[369,635,477,373.4,322.1,500,349,370.1,465,461,443,283.5,426.6,486,560,465,489,474,421,411.4,345.6,446,545.8,433,566,219.5,369,466,437,578.2,431.5,595,426,483,395.1,545,591.7,515,327.5,459,389.1,541,491.2,367,374,234,268,222,289,300,379,436],
	],
	'尿素氮': [
		[16.9,7.5,15.2,25.1,11.6,7.9,6.1,7.3,9.8,10.5,5.3,6.3,7.1,11.2,10.9,6.9,11.3,14,10.5,8.2,13.4,18,7.9,13.1,6.7,10.1,11.8,12.2,19.6,13.2,13.4,10.5,9.3,8.3,15.6,4.6,22.4,14.5,18.8,6.7,10.7,12.7,9.4],
		[8.5,29.7,26.7,8.6,9.8,14.1,8.2,8.2,13.8,7.4,9.4,8,6.6,26.2,10.8,9.2,11.3,6.4,12.2,13.2,11.3,9,14,16.7,11.2,3.4,14.2,13.7,8.1,23.6,11.1,16.6,6.5,30.7,5.1,15.1,8,18.8,29.6,8.6,38.1,11.4,14.6,7.4,12.9,11.9,8.5,7.2,6.6,13.4,11,25.9],
	],
	'GFR': [
		[14.92,72.63,21.66,16.52,70.35,42.43,50.45,26.65,34.20,31.13,52.97,86.24,65.12,21.66,18.82,42.91,40.23,26.19,37.28,41.85,25.34,13.11,42.16,40.61,65.75,48.88,34.01,18.94,15.09,21.24,28.51,35.98,42.02,38.39,21.28,82.71,19.12,46.94,13.58,31.70,31.70,38.76,33.18],
		[24.68,12.48,9.11,50.36,32.36,18.19,52.22,43.11,19.05,65.62,38.31,49.06,53.53,10.01,41.21,24.76,33.72,44.72,34.87,20.51,41.75,33.27,17.20,21.47,30.56,42.72,16.60,15.66,23.36,10.26,21.83,16.68,40.22,22.38,60.49,14.91,47.95,12.30,7.29,40.23,8.97,47.05,15.00,41.41,25.32,33.83,34.83,46.58,37.74,9.72,30.86,16.29],
	],
	'血红蛋白': [
		[124,134,92,84,140,128,130,96,141,104,160,132,111,103,126,150,118,103,107,143,129,122,135,107,125,118,120,95,96,99,164,135,130,132,114,155,109,90,100,104,141,75,114],
		[117,102,94,124,118,113,152,118,96,133,128,140,107,118,127,105,145,181,131,111,132,117,124,104,160,128,130,112,103,76,90,97,112,88,132,101,152,92,72,122,107,135,114,131,138,101,135,131,96,125,133,116],
	],
	'白细胞计数': [
		[5.48,5.11,2.48,10,8.93,4.79,5.77,7.88,6.81,5.87,6.62,4.03,7.66,6.79,4.86,5.73,7.31,9,6.1,8.35,7.85,7.84,6.78,9.42,6.23,7.27,12.94,15.68,6.87,4.98,6.49,9.17,8.6,4.79,6.23,6.6,3.43,3.27,6.11,5.97,6.37,6.41,5.85],
		[5.24,5.22,4.57,6.5,6.2,4.89,4.43,4.39,5.19,5.64,7.22,8.22,4.83,9.87,5.95,7.76,7.31,9.31,5.01,8.28,8.61,6.73,7.54,6.17,10.15,9.54,8.92,7.15,4.26,9.54,7.3,9.83,8.31,7.98,5.44,6,6.82,7.33,3.35,5.94,7.34,3.85,10.46,5.47,5.26,14.7,8.61,8.15,5.61,7.35,9.11,6.28],
	],
	'随访次数': [
		[5,19,12,8,5,8,7,10,6,6,5,5,7,7,14,7,8,9,4,4,6,12,2,6,6,3,7,5,7,4,4,8,5,7,7,10,6,6,9,4,5,3,2],
		[8,5,5,7,5,6,4,3,11,7,15,5,9,4,10,12,4,4,10,15,5,7,5,5,4,6,5,4,12,5,7,13,6,10,13,6,10,9,3,5,3,18,6,12,17,9,21,10,4,14,15,9],
	],
	'随访时长': [
		[285,406,378,315,357,312,361,336,352,353,336,280,371,335,299,348,228,307,294,297,295,308,265,273,266,171,258,193,287,262,242,252,191,224,199,199,199,198,189,126,149,112,56],
		[467,105,243,371,210,342,390,362,456,438,448,349,468,335,462,476,244,365,449,490,225,365,245,363,486,301,483,458,346,170,362,392,417,349,395,341,398,226,273,425,62,356,189,414,490,407,407,478,341,454,395,472],
	],
	'egfrSlopeK': [
		[-2.33,-2.34,-3.35,-0.88,8.82,-8.23,-0.31,-5.25,-2.24,7.47,-7.03,4.58,-4.89,-8.19,-9.83,0.66,7.23,-8.07,-1.28,1.50,1.58,4.12,12.35,-6.14,8.72,-12.74,6.87,-9.86,-6.77,1.69,-8.10,5.35,-7.87,9.61,5.50,1.93,4.00,-13.84,-2.20,-18.22,17.28,-66.09,-30.24],
		[-12.23,-26.62,-4.22,16.36,-0.67,-4.00,-2.33,1.54,0.74,0.01,5.27,-10.63,-9.38,-0.48,-11.78,0.80,-1.63,-1.11,-11.09,-1.49,-36.50,-6.61,-3.33,-5.60,-8.50,-0.82,-3.14,-2.09,-3.99,-11.38,10.05,20.69,-17.68,9.85,-19.05,-7.25,5.68,-12.17,-4.24,6.53,-5.45,-50.79,-18.18,-2.67,-12.94,24.10,-5.97,-4.75,-14.83,-2.83,-3.21,4.44],
	],
	'scr_1': [
		[4.38,39.86,6.10,12.36,0,5.10,737.83,4.12,15.83,0,7.61,0,14.09,1.85,1.55,0,0,2.22,27.45,0,0,0,0,6.26,0,4.17,0,1.94,1.18,0,2.79,0,4.99,0,0,0,0,3.93,3.68,1.48,0,0.51,0.97],
		[1.34,0.28,0.63,0,137.99,3.61,24.45,0,0,0,0,4.37,5.76,6.62,3.87,0,24.13,51.69,2.80,10.32,0.80,3.99,4.42,3.09,2.85,119.67,4.39,5.04,4.93,0.40,0,0,1.46,0,2.83,1.25,0,0.28,0.77,0,0.74,0.95,0.48,18.80,1.53,0,5.36,11.01,2.75,1.49,8.56,0],
	],
	'hbAverage': [
		[114.25,139.75,110.45,100.25,144.00,122.67,131.20,109.50,139.60,109.40,168.67,140.00,113.00,106.29,108.92,143.67,122.00,98.00,109.50,142.67,127.20,102.00,136.50,96.00,133.25,120.33,117.50,96.40,98.60,104.25,148.67,132.75,132.75,129.50,110.33,152.13,107.17,116.75,96.86,93.67,135.50,71.33,120.00],
		[110.57,94.80,98.60,128.67,110.80,101.83,139.00,118.33,102.27,135.33,128.17,134.00,110.78,98.25,130.40,122.45,145.50,178.50,132.75,105.00,99.50,124.67,121.67,104.20,154.00,136.67,108.20,106.00,102.00,84.75,112.00,133.00,104.33,106.10,120.40,82.67,139.00,94.83,76.67,133.20,97.67,107.29,100.75,131.00,104.60,130.44,129.77,129.67,94.00,91.10,130.13,108.11],
	],
	'uaAverage': [
		[440.38,277.87,426.57,469.81,373.08,463.70,430.96,398.54,490.12,299.37,309.56,342.18,405.81,451.00,318.14,525.10,399.80,492.53,387.70,414.95,386.95,451.63,390.75,416.62,451.13,478.97,397.42,427.96,425.00,462.48,518.05,379.31,441.96,468.47,361.49,377.68,657.62,414.55,406.27,389.05,432.32,460.63,511.00],
		[352.75,526.96,481.00,332.89,307.40,414.02,369.60,369.67,433.64,409.97,483.66,438.66,437.73,556.90,471.46,414.13,423.55,390.90,440.80,442.09,454.36,452.19,454.32,515.24,481.02,222.02,393.06,468.73,420.59,607.20,349.96,544.19,462.82,470.08,391.84,532.62,499.92,478.71,358.25,437.62,418.93,551.97,492.97,381.87,422.71,256.02,335.66,337.53,312.50,347.99,394.11,334.90]
	]
}

for key in data:
	print key
	print stats.ttest_ind(data[key][1],data[key][0])

# # from scipy.stats import chi2_contingency
# # # # data1 = [21,12,12,23,19,13,20,17,14,19]
# # # # data2 = [12,11,8,9,10,15,16,17,10,16]

# # # a1 = [40, 12]
# # # a2 = [36, 7]
# # print chi2_contingency(a1,a2)


# # print stats.chisquare(a1, f_exp = a2)

# import scipy.stats as stats
# import pandas as pd
# import numpy as np

# a1=[315,101,108,32]
# a2=[9,3,3,1]
# # a2 = [40, 12]
# # a1 = [36, 7]

# a1 = [9,43]
# a2 = [9,34]

# expect=[sum(a1)*i/sum(a2) for i in a2]

# print expect
# print stats.chisquare(a1,expect)


# observe=np.array([[9,43],[9, 34]])
# print stats.chi2_contingency(observe)

